//---------------------------------------------------------------------------- // File: C3DVertices.h // Class: C3DVertices [v5]-- Common 3D Vertices Class // Type: 3D Object // Author: Ken Anderson // Date: 1/29/06 // OS dependant: NA // Desc: A class designated to manage a block of vertices, it's correpsonding // textures and other properties. Requires the use of the universal // pipeline in order to operate. // Versions: // 2.0[12/16/04] -- Updated the update functionality to notify the // renderbank when a set of vertices coordinates // have been updated. // 2.1[4/27/05] -- Updated with a cache like system that uses quick access points // rather than a search feature to constantly find the next point. // Feature works best when done incrementally. // 2.2[4/28/05] -- Update with a hold feature. The hold feature restricts renderer // refreshing until the hold is released. // Other changes include the creation of the vertex block from any // vertex property change, and a private common refresh function. // 2.3[5/5/05] -- Render updated to allow parameters of rendering such as primitive // type, number of vertices & starting point. The vertexblock function // is renamed to SetPrimitiveType. // Enable/Disable function added to use the enable functionality of the // vertex block. // 3.0[5/10/05] -- Updated to use the Vertex Block B & Vertex_Packet_C Structures. // 4.0[5/14/05] -- Updated to use a Vertex Table for caching information. // 5.0[1/29/06] -- Updated to use an array rather than a link list. Link list elements removed. // Notes: // Required headers: // 1) C3DTypes.h -- Contains structures, error codes, & enumations the class // relies on. // 2) Banks3d.h -- Contains a list of renderbanks used by the common & renderer system. // 3) CRSGlobal.h -- Contains the global CRS Manager. There is only one CRS Manager // per system. //---------------------------------------------------------------------------- #ifndef __C3DVERTS__ #define __C3DVERTS__ #include "C3DTypes.h" #include "Banks3D.h" #include "CRSGlobal.h" class C3DVertices { //Allow the indices class to grab the callback. friend class C3DIndices; private: PSC3DVertices m_pVertices; //A pointer to the vertex pipeline. HRBE m_hCallback; //A handle to BEV (Bank Element Vertices) for updating. Dword m_dwCurrVertPos; //The current position in the array. bool m_bHold; public: //Constructor & Destructor. C3DVertices(); C3DVertices(const C3DVertices& verts); ~C3DVertices(); //Creation/Deletion Functions. C3DERR Create(Dword dwNumVertices=500); void Clear(); C3DERR Render(Byte byStage, Dword dwStartPoint, Dword dwNumVertices, C3DPrimitiveType PrimType); C3DERR Render(Byte byStage); C3DERR Render(); //Primitive Settings. C3DERR SetPrimitiveType(C3DPrimitiveType PrimType); C3DPrimitiveType GetPrimitiveType(); //Accessibility void Enable(); void Disable(); //Performance Modifiers. void Hold(); void ReleaseHold(); //Plots a two point vertex on x & y axis C3DERR Vertex2f(float x, float y); C3DERR Vertex2f(Dword dwIndex, float x, float y); //Plots a three point vertex on all 3 axises. C3DERR Vertex3f(float x, float y, float z); C3DERR Vertex3f(Dword dwIndex, float x, float y, float z); //Plots a four point vertex on all axises plus transformed value. C3DERR Vertex4f(float x, float y, float z, float rhw); C3DERR Vertex4f(Dword dwIndex, float x, float y, float z, float rhw); //Plots a two point texture coordinates. C3DERR Texture2f(float u, float v, Byte byStage=0); C3DERR Texture2f(Dword dwIndex, float u, float v, Byte byStage=0); //Plots three texture coordinates for environmental mapping. //Not available yet. C3DERR Texture3f(float u, float v, float t){return C3DERR_NA;} C3DERR Texture3f(Dword dwIndex, float u, float v, float t){return C3DERR_NA;} //Plots a three point normal C3DERR Normal(float x, float y, float z); C3DERR Normal(Dword dwIndex, float x, float y, float z); //Sets the colors C3DERR Diffuse(Dword dwColor); C3DERR Diffuse(Dword dwIndex, Dword dwColor); C3DERR Specular(Dword dwColor); C3DERR Specular(Dword dwIndex, Dword dwColor); //Sets a vertex as transformed or untransformed. void Transform(float fTransform); void Transform(Dword dwIndex, float fTransform); //Sets a block of vertices. //C3DERR SetVerticesBlock(C3DVertex* Block){return CO3DERR_NA;} //Get current vertex or vertex at index. Dword ReturnVerticesAmount(); PSC3DVertex GetVertex(); PSC3DVertex GetVertex(Dword dwIndex); private: //Vertex block management. void ZeroVertexElement(PSC3DVertex pElement, Byte byVType); PSC3DVertex ReturnVertexElement(Dword dwIndex); C3DERR CreateVertexBlock(); //Vertex bank management. C3DERR UpdateVertexBank(PSC3DVertices pV, TRBE trbe); void RefreshVertexBank(C3DRenderBankStates rbs=BSV_REFRESH); //Common void Cleanup(); }; #endif